﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<nelech.Models.DBModel.ForumResponse>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    רשימת נושאים בפורום
    <%= Model.category.title %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h3>
        פורום -
        <%= Model.category.title %></h3>
    <h4>
        <%= Model.category.description %></h4>

    <script language="javascript" type="text/javascript">

        function ShowText(id) {
            var e = document.getElementById("text" + id);
            e.style.display = e.style.display == "none" ? "block" : "none";
        }
        function ShowList(j) {
            var e = document.getElementById(j);
            e.style.display = e.style.display == "none" ? "block" : "none";
        } 
    </script>

    <% var parents = Model.responses.Where(p => p.p_id == null || p.p_id == 0).ToList().OrderBy(p => p.id);
       int j = 1;
       foreach (var item in parents)
       {
    %>
    <p class="haster">
        <a href="javascript:ShowList(<%= j %> )">הראה/הסתר שירשור </a>
    </p>
    <ul class="forum" id="<%= j%>" style="display: block">
        <%  
            string classRecy0 = (item.publish == 1) ? "normal" : "ryc";%>
        <li class="<%= classRecy0 %>">
            <h5>
                <% Response.Write("<a href=\"javascript:ShowText(" + item.id + ")\">" + item.title + "</a>"); %></h5>
            <%
                if (string.IsNullOrEmpty(item.text))
                { %>
            (ל"ת)
            <%} %>
            <div id="text<%= item.id %>" style="display: none">
                <%= item.text%>
                <br />
                <br />
                <%
                    if (Model != null && !string.IsNullOrEmpty(item.image))
                    {
                %>
                <p>
                    <label for="image">
                        תמונה:</label>
                    <img class="thumbs" src="<%= item.image %>" />
                    <a href="/Admin/RemovePlaceMap/<%= item.id %>">מחק</a>
                </p>
                <%} %>
            </div>
            <span class="forumName"><b>
                <%= item.name%></b>,
                <%=nelech.Views.Shared.Code.Utils.GetHebrewJewishDateString(item.date, true)%>
                <%= Html.ActionLink("ערוך", "EditResponse", "Forum", new {id = item.id }, null)%>
                |
                <%= Html.ActionLink("לסל המיחזור", "RecycleResponse", "Forum", new {id = item.id }, null)%>
                |
                <%= Html.ActionLink("החזרה", "RestoreResponse", "Forum", new {id = item.id }, null)%>
                |
                <%= Html.ActionLink("מחק", "DeleteResponse", "Forum", new {id = item.id }, null)%>
            </span>
            <ul>
                <%foreach (var res in Model.responses.Where(p => p.p_id == item.id))
                  { %>
                <%  
                    string classRecy = (res.publish == 1) ? "normal" : "ryc";%>
                <li class="<%= classRecy %>">
                    <h5>
                        <% Response.Write("<a href=\"javascript:ShowText(" + res.id + ")\">" + res.title + "</a>"); %></h5>
                    <%
                        if (string.IsNullOrEmpty(res.text))
                        { %>
                    (ל"ת)
                    <%} %>
                    <div id="text<%= res.id %>" style="display: none">
                        <%= res.text%>
                        <br />
                        <br />
                        <%
                            if (Model != null && !string.IsNullOrEmpty(res.image))
                            {
                        %>
                        <p>
                            <label for="image">
                                תמונה:</label>
                            <img class="thumbs" src="<%= res.image %>" />
                            <a href="/Forum/RemoveForumImage/<%= res.id %>">מחק</a>
                        </p>
                        <%} %>
                    </div>
                    <span class="forumName"><b>
                        <%= res.name%></b>,
                        <%=nelech.Views.Shared.Code.Utils.GetHebrewJewishDateString(res.date, true)%>
                        <%= Html.ActionLink("ערוך", "EditResponse", "Forum", new {id = res.id }, null)%>
                        |
                        <%= Html.ActionLink("לסל המיחזור", "RecycleResponse", "Forum", new {id = res.id }, null)%>
                        |
                        <%= Html.ActionLink("החזרה", "RestoreResponse", "Forum", new {id = res.id }, null)%>
                        |
                        <%= Html.ActionLink("מחק", "DeleteResponse", "Forum", new {id = res.id }, null)%>
                    </span>
                    <ul>
                        <%foreach (var res1 in Model.responses.Where(p => p.p_id == res.id))
                          { %>
                        <%  
                            string classRecy1 = (res1.publish == 1) ? "normal" : "ryc";%>
                        <li class="<%= classRecy1 %>">
                            <h5>
                                <% Response.Write("<a href=\"javascript:ShowText(" + res1.id + ")\">" + res1.title + "</a>"); %></h5>
                            <%
                                if (string.IsNullOrEmpty(res1.text))
                                { %>
                            (ל"ת)
                            <%} %>
                            <div id="text<%= res1.id %>" style="display: none">
                                <%= res1.text%>
                                <br />
                                <br />
                                <%
                                    if (Model != null && !string.IsNullOrEmpty(res1.image))
                                    {
                                %>
                                <p>
                                    <label for="image">
                                        תמונה:</label>
                                    <img class="thumbs" src="<%= res1.image %>" />
                                    <a href="/Forum/RemoveForumImage/<%= res1.id %>">מחק</a>
                                </p>
                                <%} %>
                            </div>
                            <span class="forumName"><b>
                                <%= res1.name%></b>,
                                <%=nelech.Views.Shared.Code.Utils.GetHebrewJewishDateString(res1.date, true)%>
                                <%= Html.ActionLink("ערוך", "EditResponse", "Forum", new {id = res1.id }, null)%>
                                |
                                <%= Html.ActionLink("לסל המיחזור", "RecycleResponse", "Forum", new {id = res1.id }, null)%>
                                |
                                <%= Html.ActionLink("החזרה", "RestoreResponse", "Forum", new {id = res1.id }, null)%>
                                |
                                <%= Html.ActionLink("מחק", "DeleteResponse", "Forum", new {id = res1.id }, null)%>
                            </span>
                            <ul>
                                <%foreach (var res2 in Model.responses.Where(p => p.p_id == res1.id))
                                  { %>
                                <%  
                                    string classRecy2 = (res2.publish == 1) ? "normal" : "ryc";%>
                                <li class="<%= classRecy2 %>">
                                    <h5>
                                        <% Response.Write("<a href=\"javascript:ShowText(" + res2.id + ")\">" + res2.title + "</a>"); %></h5>
                                    <%
                                        if (string.IsNullOrEmpty(item.text.Trim()))
                                        { %>
                                    (ל"ת)
                                    <%} %>
                                    <div id="text<%= res2.id %>" style="display: none">
                                        <%= res2.text%>
                                        <br />
                                        <br />
                                        <%
                                            if (Model != null && !string.IsNullOrEmpty(res2.image))
                                            {
                                        %>
                                        <p>
                                            <label for="image">
                                                תמונה:</label>
                                            <img class="thumbs" src="<%= res2.image %>" />
                                            <a href="/Forum/RemoveForumImage/<%= res2.id %>">מחק</a>
                                        </p>
                                        <%} %>
                                    </div>
                                    <span class="forumName"><b>
                                        <%= res2.name%></b>,
                                        <%=nelech.Views.Shared.Code.Utils.GetHebrewJewishDateString(res2.date, true)%>
                                        <%= Html.ActionLink("ערוך", "EditResponse", "Forum", new {id = res2.id }, null)%>
                                        |
                                        <%= Html.ActionLink("לסל המיחזור", "RecycleResponse", "Forum", new {id = res2.id }, null)%>
                                        |
                                        <%= Html.ActionLink("החזרה", "RestoreResponse", "Forum", new {id = res2.id }, null)%>
                                        |
                                        <%= Html.ActionLink("מחק", "DeleteResponse", "Forum", new {id = res2.id }, null)%>
                                    </span>
                                    <ul>
                                        <%foreach (var res3 in Model.responses.Where(p => p.p_id == res2.id))
                                          { %>
                                        <%  
                                            string classRecy3 = (res3.publish == 1) ? "normal" : "ryc";%>
                                        <li class="<%= classRecy3 %>">
                                            <h5>
                                                <% Response.Write("<a href=\"javascript:ShowText(" + res3.id + ")\">" + res3.title + "</a>"); %></h5>
                                            <%
                                                if (string.IsNullOrEmpty(item.text))
                                                { %>
                                            (ל"ת)
                                            <%} %>
                                            <div id="text<%= res3.id %>" style="display: none">
                                                <%= res3.text%>
                                                <br />
                                                <br />
                                                <%
                                                    if (Model != null && !string.IsNullOrEmpty(res3.image))
                                                    {
                                                %>
                                                <p>
                                                    <label for="image">
                                                        תמונה:</label>
                                                    <img class="thumbs" src="<%= res3.image %>" />
                                                    <a href="/Forum/RemoveForumImage/<%= res3.id %>">מחק</a>
                                                </p>
                                                <%} %>
                                            </div>
                                            <span class="forumName"><b>
                                                <%= res3.name%></b>,
                                                <%=nelech.Views.Shared.Code.Utils.GetHebrewJewishDateString(res3.date, true)%>
                                                <%= Html.ActionLink("ערוך", "EditResponse", "Forum", new {id = res3.id }, null)%>
                                                |
                                                <%= Html.ActionLink("לסל המיחזור", "RecycleResponse", "Forum", new {id = res3.id }, null)%>
                                                |
                                                <%= Html.ActionLink("החזרה", "RestoreResponse", "Forum", new {id = res3.id }, null)%>
                                                |
                                                <%= Html.ActionLink("מחק", "DeleteResponse", "Forum", new {id = res3.id }, null)%>
                                            </span></li>
                                        <%}%>
                                    </ul>
                                </li>
                                <%}%>
                            </ul>
                        </li>
                        <%}%>
                    </ul>
                </li>
                <%}%>
            </ul>
        </li>
        <% j++; %>
    </ul>
    <% } %>
    <%= Html.ActionLink("רשימת כל השותים", "ListCategory", "Forum") %>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
